package com.zx.servicelearn.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * Created by zhoux on 2018/1/31.
 * 注释：
 */


public class MySQLiteOpenHelper extends SQLiteOpenHelper {
    public static final String DB_NAME = "zx_provider_test.db";
    public static final int VERSION = 1;

    public MySQLiteOpenHelper(Context context) {
        super(context, DB_NAME, null, VERSION);
    }

    public static final String BOOK_TABLE_NAME = "book_table";
    public static final String USER_TABLE_NAME = "user_table";

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL("create table if not exists " + BOOK_TABLE_NAME + "(_id INTEGER PRIMARY KEY," + "name TEXT)");
        db.execSQL("create table if not exists " + USER_TABLE_NAME + "(_id INTEGER PRIMARY KEY," + "name TEXT," + "sex INT)");
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }
}
